package cn.kgc.tangcco.listener;

import javax.servlet.ServletRequest;
import javax.servlet.ServletRequestEvent;
import javax.servlet.ServletRequestListener;
import javax.servlet.annotation.WebListener;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSessionListener;

/**
 * @author 李昊哲
 * @Description
 * @create 2020/12/25 13:31
 */
@WebListener
public class TestListener implements HttpSessionListener, ServletRequestListener {
    @Override
    public void requestInitialized(ServletRequestEvent sre) {
        HttpServletRequest request = (HttpServletRequest) sre.getServletRequest();
        System.out.println("IP:" + request.getRemoteAddr() + ":" + request.getRemotePort() + "\t请求资源:\t" + request.getRequestURL());
    }
}
